import java.util.Scanner;
import java.util.Arrays;
public class test13 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        long x = m > n ? n : m;  // 最小公倍数
        while (m%x != 0 || n%x != 0) {
            x--;
        }
        long y = m * n / x;
        System.out.println(x + y);
    }
    public static void main45(String[] args) {
        Scanner sc=new Scanner(System.in);
        double[][] array=new double[5][5];
        double[] sum=new double[5];
        sum[0]=0.0;
        for(int i=0;i<5;i++)
        {
            for(int j=0;j<5;j++)
            {
                array[i][j]=sc.nextDouble();
                sum[i]=array[i][j]+sum[i];
            }
        }
        for(int i=0;i<5;i++)
        {
            for(int j=0;j<5;j++)
            {
                System.out.printf("%.1f ",array[i][j]);
            }
            System.out.printf("%.1f ",sum[i]);
            System.out.println();
        }
    }

    public static void main44(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int res = 0;
        while(true) {
            int sum = 0;
            while (n > 0) {
                sum += n % 10;
                n /= 10;
            }
            res = sum;
            if (res < 10) break;
            n = res;
        }
        System.out.println(res);
    }
    public static void main43(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t; i++) {
            long n = sc.nextLong();
            int value = 0;

            String ss = Long.toBinaryString(n);
            for (int j = 0; j < ss.length(); j++) {
                if (ss.charAt(j) == '1') {
                    value ++;
                }
            }
            long n1 = (long)(Math.pow(2, value) - 1);
            System.out.println(value + " " + n1);

        }
    }
    public static int show(int n) {
        if(n == 1) {
            return 1;
        } else if(n == 2) {
            return 2;
        } else {
            return show(n-1)+show(n-2);
        }
    }

    public static void main42(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int result = show(n);
        System.out.println(show(n));
    }
    public static void main41(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        int[][] array = new int[n][n];
        for(int i = 0 ; i < n ; i++) {
            for(int j = 0 ; j < n ; j++) {
                array[i][j] = sc.nextInt();
                if(i > j && array[i][j] == 0) {
                    count++;
                }
            }
        }
        if(count == n*(n-1) / 2) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
    public static void main40(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[][] array=new int[n][n];
        int p=0,q=n-1,count=1;
        while (count<=n*n) {
            for (int i=p;i<=q;i++)
                array[p][i]=count++;
            for (int i=p+1;i<=q;i++)
                array[i][q]=count++;
            for (int i=q-1;i>=p;i--)
                array[q][i]=count++;
            for (int i=q-1;i>=p+1;i--)
                array[i][p]=count++;
            p++;
            q--;
        }
        for(int[] a:array) {
            for(int i:a) System.out.print(i+ " ");
            System.out.println();
        }
    }
    public static void main39(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[][] array=new int[n][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                array[i][j]=sc.nextInt();
            }
        }
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                System.out.print(array[i][j]+" ");
            }
            System.out.println();
        }
    }
    public static void main38(String[] args) {
        Scanner sc=new Scanner(System.in);
        int m=sc.nextInt();
        int n=sc.nextInt();
        int[][] array=new int[m][n];
        int[][] brray=new int[m][n];
        double count=0.0;
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<n;j++)
            {
                array[i][j]=sc.nextInt();
            }
        }
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<n;j++)
            {
                brray[i][j]=sc.nextInt();
            }
        }
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<n;j++)
            {
                if(array[i][j]==brray[i][j])
                {
                    count++;
                }
            }
        }
        System.out.printf("%.2f",(count)/(m*n)*100);
    }
    public static void main37(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int cha=0;
        int[] array=new int[n];
        for(int i=0;i<n;i++)
        {
            array[i]=sc.nextInt();
        }
        Arrays.sort(array);
        System.out.println(array[n-1]-array[0]);
    }
    public static void main36(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[][] array=new int[n][n];
        for(int i=0;i<n;i++){
            for(int j=0;j<=i;j++){
                if(j==0||j==i){
                    array[i][j]=1;
                }else{
                    array[i][j]=array[i-1][j-1]+array[i-1][j];
                }
            }
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<=i;j++){
                System.out.printf("%5d",array[i][j]);
            }
            System.out.println();
        }
    }
    public static void main35(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            int n = sc.nextInt();
            for(int i=1;i<=n;i++) {
                for(int j=1; j<i;j++) {
                    System.out.print(" ");
                }
                for(int j=n-i+1;j>=1;j--) {
                    System.out.print("* ");
                }
                System.out.println();
            }
        }
    }

    public static void main34(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a,b,c,d;
        double result = 0.0;
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        d = sc.nextInt();
        result = a*0.2 + b*0.1 + c*0.2 + d*0.5;
        System.out.println(String.format("%.1f",result));
    }
    public static void main33(String[] args){
        Scanner scanner = new Scanner(System.in);
        int count = scanner.nextInt();
        int[] nums = new int[count];
        int[][] checks = new int[count][2];
        for(int index = 0; index < count; index++){
            nums[index] = scanner.nextInt();
        }
        for(int index = 0; index < count; index++){
            int zeroCount = 0;
            int oneCount = 0;
            int number = nums[index];
            while(number != 0){
                int bit = number & 1;
                if(bit == 0){
                    zeroCount++;
                }else if(bit == 1){
                    oneCount++;
                }
                number >>>= 1;
            }
            checks[index][0] = zeroCount;
            checks[index][1] = oneCount;
        }
        for(int index = 0; index < count; index++){
            if((checks[index][0] & 1) == 0 && (checks[index][1] & 1) == 0){
                System.out.print("10 ");
            }else if((checks[index][0] & 1) == 0){
                System.out.print("0 ");
            }else if((checks[index][1] & 1) == 0){
                System.out.print("1 ");
            }else{
                System.out.print("100 ");
            }
        }
    }
    static double getMax(int a, int b ,int c) {
        int max = a;
        if(max < b) {
            max = b;
        }
        if(max < c) {
            max = c;
        }
        return max*1.0;
    }
    public static void main32(String[] args ){

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        double m = 0.0;
        m = getMax(a+b, b, c) / (getMax(a, b+c, c) + getMax(a, b, b+c));
        System.out.println(String.format("%.2f", m));
    }
    public static void main31(String[] args){
        Scanner scanner = new Scanner(System.in);
        int length = scanner.nextInt();
        int[] words = new int[length];
        for(int index = 0; index < length; index++){
            words[index] = scanner.nextInt();
        }
        float price = 0.0f;
        for(int wordCount : words){
            price += wordCount > 60 ? 0.2 : 0.1;
        }
        System.out.printf("%.1f", price);
    }

    public static void main30(String[]args){
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        int i = str.indexOf(",");
        int j = str.indexOf("=");
        String str1=str.substring(j+1,i);
        String str2=str.substring(i+3);
        System.out.println("a="+str2+","+"b="+str1);

    }
    public static void main29(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();

        StringBuilder stringBuilder = new StringBuilder(str);
        for(int index = str.length() - 3; index > 0; index -= 3){
            stringBuilder.insert(index, ',');
        }
        System.out.print(stringBuilder.toString());
    }
    public static void main28(String[] args) {
        Scanner scan = new Scanner(System.in);
        float w = scan.nextFloat();
        char j = scan.next().charAt(0);
        int p ;

        if (w <= 1){
            p = 20;
        }else{
            p = 20 + (int)(w - 0.1);
        }
        if (j == 'y'){
            System.out.println(p + 5);
        }else{
            System.out.println(p);
        }
    }
    public static void main27(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int[] score = new int[3 * n];

        int count = 0;
        for (int j = 0; j < n; j++) {
            int sum = 0;
            for (int i = 0; i < 3 ; i++) {
                score[i] = scan.nextInt();
                sum += score[i];
            }
            if (sum/3 < 60){
                count++;
            }
        }
        System.out.println(count);

    }
    public static void main26(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        if(num % 2 == 0){
            System.out.print(2 + " ");
        }
        if(num % 3 == 0){
            System.out.print(3 + " ");
        }
        if(num % 7 == 0){
            System.out.print(7 + " ");
        }
        if(num % 2 != 0 && num % 3 != 0 && num % 7 != 0){
            System.out.print("n");
        }
    }
    public static void main25(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] arr = sc.next().split(":");
        int k = sc.nextInt();
        int h = Integer.parseInt(arr[0]);
        int m = Integer.parseInt(arr[1]);
        int allM = h * 60 + m + k;
        System.out.printf("%02d:%02d", allM/60%24, allM%60);
    }
    public static void main24(String[]args){
        Scanner in =new Scanner(System.in);
        String num = in.nextLine();
        String []nums=num.split(" ");
        int []list= new int[nums.length];
        for(int i =0;i<nums.length;i++)
        {
            list[i]=Integer.parseInt(nums[i]);
        }
        System.out.println((int)(10000/(3.14*list[0]*list[1]*list[1])+1));
    }
    public static void main23(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNextInt()) {
            int time = scan.nextInt();
            if(time > 0) {
                System.out.println(1);
            } else if(time == 0) {
                System.out.println(0.5);
            } else {
                System.out.println(0);
            }

        }
    }
    public static void main22(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //n盒牛奶
        int n = scanner.nextInt();
        //h分钟能喝完
        int h = scanner.nextInt();
        //m分钟后还有多少牛奶
        int m = scanner.nextInt();

        if(m % h == 0) {
            System.out.println(n - (m / h));
        } else {
            System.out.println(n - (m / h + 1));
        }

    }
    public static void main21(String arg[]){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            String[] str=sc.nextLine().split(" ");
            String admin=str[0];
            String password=str[1];
            if(admin.equals("admin")&&password.equals("admin"))
            {
                System.out.println("Login Success!");
            }else{
                System.out.println("Login Fail!");
            }
        }
    }
    public static void main20(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n =sc.nextInt();
        int[][] array= new int[n][n];
        int count = 1;
        for (int i=0;i<2*n-2;i++) {
            for (int j=0;j<=i;j++) {
                int x=i-j;
                if (x<n&&j<n) {
                    if(i%2==0) {
                        array[x][j]=count;
                    } else{
                        array[j][x]=count;
                    }
                    count++;
                }
            }
        }
        array[n-1][n-1]=count;
        for (int i=0;i<n;i++) {
            for (int j=0;j<n;j++) {
                System.out.print(array[i][j]+" ");
            }
            System.out.println();
        }
    }
    public static void main19(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        int[][] array = new int[n][n];
        for(int i = 0 ; i < n ; i++) {
            for(int j = 0 ; j < n ; j++) {
                array[i][j] = sc.nextInt();
                if(i > j && array[i][j] == 0) {
                    count++;
                }
            }
        }
        if(count == n*(n-1) / 2) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
    public static void main18(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] score=new int[7];
        while(sc.hasNext())
        {
            for(int i=0;i<7;i++)
            {
                score[i]=sc.nextInt();
            }
            Arrays.sort(score);
            double average=(score[1]+score[2]+score[3]+score[4]+score[5])/5.0;
            System.out.printf("%.2f\n",average);
        }
    }
    public static void main17(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = 0;
        int[] primes = new int[105];
        int[] st = new int[105];
        Arrays.fill(st, 0);
        for(int i = 2; i <= n; i++){
            if(st[i] == 0){
                primes[k++] = i;
                for(int j = i+i; j <= n; j+=i){
                    st[j] = 1;
                }
            }
        }
        for(int i = 0; i < k; i++){
            System.out.print(primes[i]+" ");
        }
        System.out.println();
        System.out.println(n-k-1);
    }
    public static void main16(String[] args) {
        Scanner in = new Scanner(System.in);
        double a = in.nextInt();

        int n = (-1+(int)Math.sqrt(1+8*a))/2;   //计算上轮日薪
        a = a-n*(1+n)/2;                        //计算本轮日薪的日子
        int sum = 0;
        sum = n*(n+1)*(2*n+1)/6;                //求和计算之前总薪水
        if(a != 0){                             //通过本轮日薪的日子计算本轮总薪水
            sum += a*(1+n);
        }
        System.out.println(sum);
    }
    public static void main15(String[] args) {

        Scanner sc = new Scanner(System.in);
        double weight = sc.nextDouble();
        double height = sc.nextDouble();
        double bmi = weight / (height * height);
        if(bmi >= 18.5 && bmi <= 23.9) {
            System.out.println("Normal");
        } else {
            System.out.println("Abnormal");
        }
    }
    public static void main14(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int y = scanner.nextInt();
        int m = scanner.nextInt();
        int d = scanner.nextInt();
        int y1 = scanner.nextInt();
        int m1 = scanner.nextInt();
        int d1 = scanner.nextInt();
        if(y < y1){
            System.out.print("yes");
        }else if(y == y1){
            if(m < m1){
                System.out.print("yes");
            }else if(m == m1){
                if(d <= d1){
                    System.out.print("yes");
                }else{
                    System.out.print("no");
                }
            }else{
                System.out.print("no");
            }
        }else{
            System.out.print("no");
        }
    }
    public static void main13(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        // 构造回文数
        String str = "" + n;
        StringBuilder sb = new StringBuilder();
        sb.append(str.substring(0, str.length()-1));
        String num = "" + n + sb.reverse().toString();
        long res = Long.parseLong(num);

        // 判断回文数是否是素数
        for (long i=2; i*i <= res; i++) {
            if (res % i == 0) {
                System.out.println("noprime");
                return;
            }
        }
        System.out.println("prime");
    }
    public static void main12(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] n = in.nextLine().toCharArray();
        String num = "";
        for (int i = 0; i < n.length; i++) {
            num += (int)n[i] % 2;
        }
        System.out.print(Integer.parseInt(num));
        in.close();
    }
    public static void main11(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            long a = in.nextLong();
            long b = in.nextLong();
            long max = gcb(a,b);
            //最小公倍数
            long min = a*b/gcb(a,b);
            System.out.println(max+min);
        }
    }
    //最大公约数
    public static long gcb(long a, long b) {
        if (b == 0) return a;
        return gcb(b, a%b);
    }
    public static void main10(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int x1 = scanner.nextInt();
        int y1 = scanner.nextInt();
        if(y + 1 == y1 && x == x1){
            System.out.print('u');
        }else if(y - 1 == y1 && x == x1){
            System.out.print('d');
        }else if(x + 1 == x1 && y == y1){
            System.out.print('r');
        }else if(x - 1 == x1 && y == y1){
            System.out.print('l');
        }
    }
    public static void main9(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int e = 3*n-1;

        for(int i=0;i<n;i++){
            for(int k=0;k<e;k++){
                System.out.print(" ");
            }

            for(int j=0;j<i+1;j++){
                System.out.print("*");
                System.out.print("     ");
            }

            System.out.println();

            e -=1;

            for(int k=0;k<e;k++){
                System.out.print(" ");
            }
            for(int j=0;j<i+1;j++){
                System.out.print("* *");
                System.out.print("   ");
            }
            System.out.println();

            e -=1;
            for(int k=0;k<e;k++){
                System.out.print(" ");
            }
            for(int j=0;j<i+1;j++){
                System.out.print("* * *");
                System.out.print(" ");
            }
            System.out.println();

            e -=1;

        }

        for (int p= 0;p<n;p++){
            for(int q=0;q<(3*n-1);q++){
                System.out.print(" ");
            }
            System.out.println("* ");
        }

    }
    public static void main8(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String[] strs = str.split(" ");
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<strs.length; i++){
            sb.append(strs[i].charAt(0)+"");
        }
        System.out.println(sb.toString().toUpperCase());
    }
    public static void main7(String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int[] array=new int[n];
    for(int i=0;i<n;i++)
    {
        array[i]=sc.nextInt();
    }
    Arrays.sort(array);
    for(int i=array.length-1;i>=array.length-5;i--)
    {
        System.out.print(array[i]+" ");
    }
}

    public static int num = 0;
    public static void main6(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            fun('a', 'b', 'c', n);
            System.out.println(num);
            num = 0;
        }

    }

    public static void fun(char a, char b, char c, int n) {
        if (n == 0) {
            return;
        }
        fun(a, b, c, n - 1);
        num++;
        fun(c, b, a, n - 1);
        num++;
        fun(a, b, c, n - 1);

    }
    public static void main5(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] array = new int[n][m];
        int max = Integer.MIN_VALUE;
        int maxX = 0;
        int maxY = 0;
        for(int i = 0 ; i < n ; i++) {
            for(int j = 0 ; j < m ; j++) {
                array[i][j] = sc.nextInt();
                if(array[i][j] > max) {
                    max = array[i][j];
                    maxX = i + 1;
                    maxY = j + 1;
                }
            }
        }
        System.out.println(maxX + " " + maxY);
    }
    public static void main4(String[] args) {
        Scanner sc = new Scanner(System.in);
        String words = sc.nextLine();
        int maxn = 0;
        int minn = words.length();
        for (int i = 0; i < words.length(); i++) {
            int count = 0;
            char c = words.charAt(i);
            for (int j = 0; j < words.length(); j++) {
                if (c == words.charAt(j)) {
                    count ++;
                }
            }
            if (count > maxn) {
                maxn = count;
            }
            if (count < minn) {
                minn = count;
            }
        }

        // 判断差是否为质数
        int num = maxn - minn;
        if (num < 2) {
            System.out.println("No Answer");
            System.out.println(0);
            return;
        }
        if (num == 2) {
            System.out.println("Lucky Word");
            System.out.println(num);
            return;
        }
        boolean flag = true;
        for (int i = 2; i < Math.sqrt(num); i++) {
            if (num % 2 == 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            System.out.println("Lucky Word");
            System.out.println(num);
        } else {
            System.out.println("No Answer");
            System.out.println(0);
        }
    }
    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.next();

        char opera = '0';
        int indexs = -1; //如果下标为-1 则输入的运算符没有加减乘除
        for(int i = 0; i < str.length(); i++) {
            switch(str.charAt(i)) {
                case '+': indexs = i; opera = '+';
                    break;
                case '-': indexs = i; opera = '-';
                    break;
                case '*': indexs = i; opera = '*';
                    break;
                case '/': indexs = i; opera = '/';
                    break;
            }
        }
        if(indexs == -1) {
            System.out.println("Invalid operation!");
        } else {
            String zfx1 = str.substring(0, indexs);
            String zfx2 = str.substring(indexs + 1, str.length());
            double x1 = Double.parseDouble(zfx1);
            double x2 = Double.parseDouble(zfx2);
            switch(opera) {
                case '+': System.out.printf("%.4f+%.4f=%.4f", x1, x2, (x1 + x2));
                    break;
                case '-': System.out.printf("%.4f-%.4f=%.4f", x1, x2, (x1 - x2));
                    break;
                case '*': System.out.printf("%.4f*%.4f=%.4f", x1, x2, (x1 * x2));
                    break;
                case '/':if(x2 == 0) {
                    System.out.println("Wrong!Division by zero!");
                } else {
                    System.out.printf("%.4f/%.4f=%.4f", x1, x2, (x1 / x2));
                }
            }
        }
    }
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        for (int i = 1; i <= num; i++) {
            StringBuffer buffer = new StringBuffer(String.valueOf(i));
            StringBuffer reverse = buffer.reverse();

            if (reverse.toString().equals(String.valueOf(i))){
                System.out.println(i);
            }
        }
    }

        public static void main1(String[] args) {
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            for(int i = a;i<=b;i++) {
                if(number(i)) {
                    System.out.print(i+" ");
                }else{
                    continue;
                }
            }
        }

        public static boolean number(int n){
            int sum =0;
            int count = 0;
            int d= n;
            while(n!=0){
                sum = n%10;
                n = n/10;
                count += sum*sum*sum*sum;
            }
            if(count == d) {
                return true;
            }else {
                return false;
            }
        }
    }